'use strict';
exports.main = (event, context) => {
	//event为客户端上传的参数
	const db = uniCloud.database();
	const user = db.collection('uni-id-users').where({
		user: event.user,
		password: event.password
	}).get().then((res) => {
		const users = res.data;
		const result = users.map((u) => {
			return { user: u.user };
		});
		return { data: result };
	})
		.catch((err) => {
			return { error: err };
		});
	//返回数据给客户端
	return user
};
